<template>
  <div class="orderuser">
    <van-nav-bar title="订购人信息" left-text left-arrow @click-left="$router.go(-1)" />
    <p>
      <span>订购人姓名：</span>
      <input type="text" v-model="orderuser" />
    </p>
    <p>
      <span>订购人手机：</span>
      <input type="text" v-model="orderphone" />
    </p>
    <div class="tips">
      <span>请填写您本人的手机，不是收货人手机，以便送达时短信通知您</span>
    </div>
    <div @click="handleInfo" class="makesure">
      <span>确定</span>
    </div>
  </div>
</template>
<style scoped>
.orderuser {
  width: 100%;
  height: 100%;
  flex: 1;
  background: #fff;
  display: flex;
  flex-direction: column;
}
.orderuser .van-hairline--bottom {
  line-height: 0.5rem;
  height: 0.5rem;
  margin-bottom: 0.01rem;
  font-size: 0.18rem;
  border-bottom: 0.01rem solid #e8edf1;
}
.orderuser p {
  padding-left: 0.1rem;
  display: flex;
  justify-content: left;
  width: 100%;
  height: 0.6rem;
  background: #fff;
  margin-bottom: 0.01rem;
  font-size: 0.18rem;
  line-height: 0.6rem;
  border-bottom: 0.01rem solid #e8edf1;
}
.orderuser input {
  border: 0;
}
.orderuser .tips {
  border-top: 0.01rem solid #e8edf1;
  font-size: 0.16rem;
  color: #fe734c;
  background: #fff;
  height: 0.6rem;
  padding: 0.1rem 0.1rem 0;
  text-align: left;
}
.orderuser .makesure {
  width: 50%;
  height: 0.4rem;
  font-size: 0.18rem;
  background: #fe734c;
  border-radius: 0.2rem;
  margin: 0 auto;
  line-height: 0.4rem;
  color: #fff;
}
</style>
<script>
import { mapState, mapMutations, mapAction } from "vuex";
export default {
  data() {
    return {
      orderuser: "",
      orderphone: ""
    };
  },
  methods: {
    ...mapMutations("product", ["saveOrder"]),
    handleInfo() {
      if (this.orderuser == "" || this.orderphone == "") {
        this.$toast.fail("请输入完整信息");
      } else {
        this.saveOrder({
          orderuser: this.orderuser,
          orderphone: this.orderphone
        });
        this.$router.push({ name: "SubmitOrder" });
      }
    }
  }
};
</script>